# Importing Data
TAIWAN<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Steel/TSA.xlsx",sheet = "Sheet1", range = "AH1:AH239")

# Checking the Imported Data
View(TAIWAN)
# Creating Time Series Data
TAIWAN_ts <- ts(TAIWAN, start=c(2000,1), end=c(2019,09), frequency=12)
# Viewing and Checking the Created Time Series Data
TAIWAN_ts
sum(is.na(TAIWAN_ts))
library(forecast)
TAIWAN_ts <- tsclean(TAIWAN_ts)
TAIWAN_ts

# Identification: Plotting the Time Series Data
plot(TAIWAN_ts)

# Estimating the appropriate model
TAIWAN_ts_model <- auto.arima(TAIWAN_ts)
TAIWAN_ts_model

# Forecasting
options(max.print=1000000)
TAIWAN_ts_forecast <- forecast (TAIWAN_ts_model, level=c(95), h=255)
plot(TAIWAN_ts_forecast)
TAIWAN_ts_forecast             

# Exporting
write.table(TAIWAN_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Steel/TAIWAN_TSA.csv", sep=",")
